package org.chuanyang.mm.utils;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class HandleDateAndTime {

	public Calendar calendar = Calendar.getInstance();
	public DateFormat dateAndTimeFormat = new SimpleDateFormat(
			"yyyy-MM-dd HH:mm");
	public DateFormat onlyDate = new SimpleDateFormat("yyyy-MM-dd");
	public DateFormat onlyTime = new SimpleDateFormat("HH:mm");

	public String getCurDateAndTime() {
		return dateAndTimeFormat.format(new Date(System.currentTimeMillis()));
	}

	public String getCurDate() {
		return onlyDate.format(new Date(System.currentTimeMillis()));
	}

	public String getCurTime() {
		return onlyTime.format(new Date(System.currentTimeMillis()));
	}

	public String getSetDate() {
		return onlyDate.format(calendar.getTime());
	}

	public String getSetTime() {
		return onlyTime.format(calendar.getTime());
	}

	public String getSetDateAndTime() {
		return dateAndTimeFormat.format(calendar.getTime());
	}
}
